﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="aboutTitle" ContentPlaceHolderID="TitleContent" runat="server">
	Quản lý khách hàng
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Quản lý khách hàng</h2>
    <% using (Html.BeginForm())
       { 
       Html.RenderPartial("QLKhachHangButton"); %>
    <div>
        <fieldset>
            <legend>Danh sách khách hàng</legend>
            <table>
                <tbody>
                    <tr>
                        <th><input type="checkbox" name="checkAll" /></th>
                        <th>ID</th>
                        <th>Tên đăng nhập</th>
                        <th>Email</th>
                        <th>Họ tên</th>
                        <th>CMND</th>
                        <th>Giới tính</th>
                        <th>Ngày đăng ký</th>
                        <th>Điểm</th>
                        <th colspan="2"  align="center">Lựa chọn</th>
                    </tr>
                    <%
           Dictionary<int, string> GioiTinh = (Dictionary<int, string>)ViewData["GioiTinh"];
           foreach (DTO.KhachHangDTO khachhang in (List<DTO.KhachHangDTO>)ViewData["dsKhachHang"])
           {  %>
                    <tr>
                        <td><input type="checkbox" name="check[<% Response.Write(khachhang.Id); %>]" /></td>
                        <td><% Response.Write(khachhang.Id); %></td>
                        <td><% Response.Write(khachhang.Tendangnhap); %></td>
                        <td><% Response.Write(khachhang.Email); %></td>
                        <td <% if (khachhang.LaKHTT) { Response.Write("class='KHTT'"); }%> ><% Response.Write(khachhang.Hoten); %></td>
                        <td><% Response.Write(khachhang.Cmnd); %></td>
                        <td><% Response.Write(GioiTinh[khachhang.Gioitinh]); %></td>
                        <td><% Response.Write(khachhang.Ngaydangky); %></td>
                        <td><% if (khachhang.LaKHTT) { Response.Write(khachhang.DiemThuong); }%></td>
                        <td align="center"> <%: Html.ActionLink("Sửa", "Sua", "QLKhachHang", new { id = khachhang.Id }, null)%></td>
                    </tr>
                    <%
           } %>
                </tbody>
            </table>
        </fieldset>
    </div>
    <% } %>
</asp:Content>
